Computing the Size of an Embedded Dialog

Description

This script demonstrates how the size of a parent dialog box can be automatically calculated with the UI_INFO_DLG_DEF_CLIENT_HEIGHT()and UI_INFO_DLG_DEF_CLIENT_WIDTH()functions so that the embedded dialog box that it contains can be displayed correctly, without clipping any portion of the embedded dialog box. This statement creates some content for the embedded list box.

list = a5.Color_Enum()

This statement defines the embedded list box.

str = <<%dlg%
{nocaption}
[.100,5^#list];
%dlg%

The UI_INFO_DLG_DEF_CLIENT_HEIGHT()and UI_INFO_DLG_DEF_CLIENT_WIDTH() functions calculate the size of the embedded dialog.

w = ui_info_dlg_def_client_width(str)
h = ui_info_dlg_def_client_height(str)
ui_msg_box("Size of embedded dialog: ","width: " + w + crlf()+ "height : " + h)

The script substitutes the actual calculated size of the embedded dialog into the parent dialog.

dlg_body = <<%dlg%
{startup=init}
{embedded=w",h":window}
%dlg%
dlg_body = stritran(dlg_body,"h","" + h)
dlg_body = stritran(dlg_body,"w","" + w)

The script displays only the parent dialog.

ui_msg_box("Parent Dialog Body - with placeholders for Height and Width replaced", dlg_body)

The script displays the parent and embedded dialogs.

ui_msg_box("Parent Dialog Body - with placeholders for Height and Width replaced", dlg_body)
ui_dlg_box("Dialog Box with Embedded Dialog - Parent Dialog is correctly sized",dlg_body,<<%code%
if a_dlg_button = "init" then
    ui_modeless_dlg_box("window",str,"1=1")
end if
%code%)

Limitations

Desktop applications only.

See Also